-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: SSA typing for loop bounds #4290
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The frontend does unify the type for loop bounds. The issue is related to #4118 where the frontend does not actually have a type for "any integer except Field." Once that PR is fixed & merged this issue should be fixed as well.
Thanks Jake! Will it also fix a case like this one?:
Where the N is not only used in the end range, but also in |
Oh, I think your message in that PR addresses exactly that |
# Description Add a new `TypeVariableKind` specifically for Integers: until this PR, `IntegerOrField` is used. ## Problem\* May resolve #3639, #4290 ## Summary\* Adds the new `TypeVariableKind` - [x] Unify - [x] Test - [ ] Docs ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [x] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --------- Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: jfecher <jake@aztecprotocol.com>
@jfecher @michaeljklein just tested on master after #4118 was merged and we still have different types in the example in the description:
|
@sirasistant yep, sorry that is expected. We decided to split that PR into one that adds the new type variable kind, and then another later PR to use the new type variable kind in for loops and bitwise operations. I'll update this thread when the second PR is up |
@sirasistant #4376 should fix the issue |
fixed in #4386 |
# Description ## Problem\* Resolves #4290 ## Summary\* Previously, the monomorphizer would assume all numeric generics were Fields, but this was not necessarily true. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
Description
Problem*
Partial work towards #4275
Summary*
The frontend is not enforcing typing on loop bounds in some cases:
This PR casts the types of the bounds at the SSA level with the iterator type but we might want to enforce this in the frontend instead. I think the mismatch only happens on generic bounds so it might be painful to fix.
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.